/*
 * @Author: chengsl
 * @Date: 2023-01-06 14:56:45
 * @LastEditors: chengsl
 * @LastEditTime: 2023-01-06 18:06:47
 * @Description: 环饼图  widgetRingPieChart
 */
import * as echarts from 'echarts'
export default {
  title: {
    show: true,
    textStyle: { color: '#fff', fontSize: 60, fontWeight: 'bold' },
    subtext: '总数',
    subtextStyle: { color: '#fff', fontWeight: 'normal', fontSize: 24 },
    x: '29%',
    y: '46%',
    textAlign: 'center',
    itemGap: 15,
    text: '24'
  },
  legend: {
    show: true,
    top: 'center',
    left: 'right',
    right: 0,
    orient: '',
    itemGap: 16,
    itemWidth: 20,
    itemHeight: 19,
    icon: 'circle',
    textStyle: { color: '#A9B2BC', fontSize: 19 },
    // formatter: (name) => {
		// 	// 动态显示数值
		// 	const singleData = data.filter(item => item.name === name)
		// 	const percentage = (singleData[0].value / total * 100).toFixed(2)
		// 	const result = name + '：' + percentage + ' %'
		// 	return result
		// }
  },
  tooltip: {
    trigger: 'item',
    show: true,
    textStyle: { color: '#464646', fontSize: 12 },
    formatter: ({ marker, name, value, percent }) => {
			const result = marker + name + '：' + echarts.format.addCommas(value) + `<br />` + percent + '%'
			return result
		}
  },
  series: [
    {
      type: 'pie',
      radius: ['50%', '70%'],
      center: ['30%', '55%'],
      color: [
        '#0060FF',
        '#3BD6FF',
        '#948BEA',
        '#F78D94',
        '#FF7A45',
        '#FCBB61',
        '#36CFC0'
      ],
      data: [
        { name: '外部', value: 8 },
        { name: '医院自主设备', value: 4 },
        { name: '健康在线', value: 2 },
        { name: '其他', value: 10 }
      ],
      avoidLabelOverlap: false,
      label: {
        show: false,
        formatter: '{a|{b}：{c} }',
        rich: {
          a: {
            padding: [-30, 15, -20, 15],
            color: '#fff',
            fontSize: 14,
            fontWeight: 'normal'
          }
        },
        fontSize: 14
      },
      lableLine: { show: false },
      labelLine: { show: false }
    }
  ]
}
